package com.food.controller;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.food.dao.service.MemberService;
import com.food.model.Member;


@WebServlet("/GetMbName")
public class GetMbName extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html; charset=utf-8");
		
		
		int mbid = Integer.parseInt(request.getParameter("mbid"));
		MemberService memberService = new MemberService();
		Member member = new Member();
		member.setMbid(mbid);
		member = memberService.findMember(member);
		response.getWriter().print(member.getMbname());
		
		
	}

}
